package pt.iscte.pcd.project.server;

import java.io.IOException;

import pt.iscte.pcd.project.order.Order;


public class DealWithClientSender extends Thread{
	
	private DealWithClient dealClient;
	
	public DealWithClientSender(DealWithClient dealClient) {
		this.setDealClient(dealClient);
		
	}
	
	@Override
	public void run() {
		super.run();
		while(!isInterrupted()){
			Order order;
			try {
				order = dealClient.retiraPedidoParaEnviar();
				dealClient.getOut().reset();
				dealClient.getOut().flush();
				dealClient.getOut().writeObject(order);
			} catch (InterruptedException e) {
			} catch (IOException e) {
			}
			
		}
		
		
	}
	
	
	

	public DealWithClient getDealClient() {
		return dealClient;
	}

	public void setDealClient(DealWithClient dealClient) {
		this.dealClient = dealClient;
	}
	
	
	
	

}
